using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using TidhiGanitam.DataModel;

namespace TidhiGanitam.Ganitam
{
    public class Dinamu
    {
        private int m_Year;
        private Ravi m_Ravi;
        private DateTime m_Ugadi;
        private ArrayList m_DailyRoutines;
        private YearDetails m_CurrYrDetails;
        public ArrayList DailyCalculations
        {
            get {
                return m_DailyRoutines;
            }
            set {
                m_DailyRoutines = value;
            }
        }
        public Dinamu(int Year,YearDetails CurrentYearDetails, Ravi Ravi)
        {
            m_Year = Year;
            m_Ravi = Ravi;
            m_Ugadi = CurrentYearDetails.UgadiDate;
            m_CurrYrDetails =new YearDetails(CurrentYearDetails);
        }
        public void DoDailyRoutinesForYear()
        {
            m_DailyRoutines = new ArrayList();
            //Rasi IyanamsaValue = Constants.IyanamsaValue2008;
            DinamuRoutineItem PreviousDinamuRoutine = new DinamuRoutineItem(0, m_Year, m_Ugadi, m_CurrYrDetails.UgadiIyanamsamu, ((RaviRoutineItem)m_Ravi.DailyCalculations[0]));
            for (int iSNo = 0; iSNo < 400; iSNo++)
            {
                DinamuRoutineItem RoutineItem = new DinamuRoutineItem(iSNo, m_Year, m_Ugadi.AddDays(iSNo),
                                   PreviousDinamuRoutine.Iyanamsamu ,((RaviRoutineItem)m_Ravi.DailyCalculations[iSNo]));
                RoutineItem.Calculate();
                m_DailyRoutines.Add(RoutineItem);
                PreviousDinamuRoutine = RoutineItem;
            }
        }
    }
}
